// 商品分类
import { request } from "./request"

// 获取商品信息
export function categories(type, pagenum, pagesize) {
    console.log(pagenum)
    return request({
        url: "/categories",
        method: "get",
        params: {
            type,
            pagenum,
            pagesize
        }
    })
}

//添加商品分类操作
export function addcategories(addgoods) {
    return request({
        url: "/categories",
        method: "post",
        data: {
            cat_pid: addgoods.cat_pid,
            cat_name: addgoods.cat_name,
            cat_level: addgoods.cat_level

        }
    })
}

// 删除分类
export function deletecategories(id) {
    return request({
        url: `categories/${id}`,
        method: "delete"
    })
}

// 编辑商品信息
export function putcategories(id, cat_name) {
    return request({
        url: `categories/${id}`,
        method: "put",
        data: {
            cat_name
        }
    })
}